
const { ccclass, property } = cc._decorator;

@ccclass
export class AddScore extends cc.Component {

    private score_label: cc.Label = null;

    protected onLoad(): void {
        this.score_label = this.node.getComponent(cc.Label);
    }

    start() {

    }

    public showAddAnim(score: number) {
        this.score_label.string = "+" + score;
        cc.Tween.stopAllByTarget(this.node);
        this.node.opacity = 255;
        cc.tween(this.node)
            .by(0.2, { position: cc.v3(0, 30, 0) })
            .delay(0.2)
            .to(0.2, { opacity: 0 })
            .call(() => { this.node.destroy() })
            .start()
    }

    update(deltaTime: number) {

    }
}


